package com.power.sifa.correction.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.query.Param;
import com.power.sifa.correction.model.Crc_group;

import javax.transaction.Transactional;
import java.io.Serializable;
import java.util.List;

/**
 * 社区矫正人员分组信息 持久层(hibernate)
 */

public interface Crc_groupDao extends JpaRepository<Crc_group, Serializable>, JpaSpecificationExecutor<Crc_group>, Repository<Crc_group, Serializable>, Crc_groupDaoCustom<Crc_group, Serializable> {

   @Modifying
   @Transactional
   @Query("update Crc_group s set s.deleted = 1  where  s.id in (:ids)")
   void removeByIds(@Param("ids") List<String> ids);


   @Query(" from Crc_group s where s.id in (:groupIds) and s.deleted = 0 ")
   List<Crc_group> findByGroupIds(@Param("groupIds") List<String> groupIds);

}
